import {action, Service} from "adajs";
import User from "./../../lib/user";

class SettingService extends Service {
    defaultData() {
        let userInfo = User.getUserInfo();
        return {
            icon: "",
            name: userInfo.userRealname,
            part: userInfo.deptName,
            phone: userInfo.phoneNumber,
            setlist: [
                {name: '使用帮助', icon: ':for-help_outline', link: "/my/setting/help"},
                // {name: '套餐余量', icon: ':for-pie-chart', link: "/my/setting/meal"},
                {name: '修改密码', icon: ':for-lock_open', link: "/my/setting/password"}
            ]
        };
    }

    onupdate(current, data) {
        Object.assign(current, data);
    }

    @action("setImage")
    setImage(current, src) {
        current.icon = src;
    }
}

export default SettingService;